﻿/**
 * @author sminutoli
 */
import com.dinmax.flash.utilities.xml.XMLParameters

class com.dinmax.flash.utilities.xml.XMLAction
implements com.dinmax.flash.utilities.xml.XMLCapable {
	
	private var name:String=undefined;
	private var nodeName:String = "action";
	private var parameters:XMLParameters;
	private var extraatts:String="";
	
	public function XMLAction() {
		this.parameters = new XMLParameters();
	};
			
	public function getNodeName():String {
		return nodeName;
	}

	public function setNodeName(nodeName:String):Void {
		this.nodeName = nodeName;
	}
	
	public function getName():String {
		return this.name;
	};
	
	public function getParameters():XMLParameters {
		return parameters;
	};

	public function setParameters(parameters:XMLParameters):Void {
		this.parameters = parameters;
	};
	
	public function addParameter(key:String, value:String):Void{
		this.parameters.addItem(key, value);
	};
	
	public function addAttribute(key:String, value:String):Void{
		this.extraatts+=" "+key+"='"+value+"' ";
	};
	
	
	function toXML(noHeader:Boolean):String {
		var xmlAct:String = new String();
		xmlAct+= "<"+this.getNodeName()+" name='"+this.getName()+"'"+this.extraatts+">";
		xmlAct+= this.getParameters().toXML(true);
		xmlAct+= "</"+this.getNodeName()+">";
		//trace("XMLAction.as | toXML "+xmlAct);
		return xmlAct;
	};
	
	function execute():String {
		return undefined;
	};
	
};